<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="file">
  <script>
    const ipt = document.querySelector('input')
    // file 两次上传同样的文件的时候, 默认情况下第二次是不会触发change事件的
    ipt.addEventListener('change',(e)=>{
      console.log(e.target.files[0]);
      console.log(e.target.value );
      // 将文件域的value清空
      e.target.value = ''
    })
  </script>
</body>
</html>